<!DOCTYPE html>
<html
        xmlns:th="http://www.thymeleaf.org"
        xmlns:layout="http://ultraq.net.nz/thymeleaf/layout"
        xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5"
        th:fragment="header">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,shrink-to-fit=no"/>
    <link href="../../static/css/tether.css" th:href="@{/css/tether.min.css}" rel="stylesheet"/>
    <link href="../../static/css/bootstrap.min.css" th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link href="../../static/css/fontawesome.min.css" th:href="@{/css/fontawesome.min.css}" rel="stylesheet"/>
    <link href="../../static/css/nprogress.css" th:href="@{/css/nprogress.css}" rel="stylesheet"/>
    <link href="../../static/css/thinker-md.vendor.css" th:href="@{/css/thinker-md.vendor.css}" rel="stylesheet"/>
    <link href="../../static/css/bootstrap-tagsinput.css" th:href="@{/css/bootstrap-tagsinput.css}" rel="stylesheet"/>
    <link href="../../static/css/chosen.min.css" th:href="@{/css/chosen.min.css}" rel="stylesheet"/>
    <link href="../../static/css/toastr.min.css" th:href="@{/css/toastr.min.css}" rel="stylesheet"/>
    <link href="../../static/css/jquery.cropbox.css" th:href="@{/css/jquery.cropbox.css}" rel="stylesheet"/>
    <link href="../../static/css/style.css" th:href="@{/css/style.css}"/>
    <link href="../../static/css/thymeleaf-bootstrap-paginator.css" th:href="@{/css/thymeleaf-bootstrap-paginator.css}"
          rel="stylesheet"/>
    <link href="../../static/css/blog.css" th:href="@{/css/blog.css}" rel="stylesheet"/>
    <title>Title</title>
</head>
<body>
<nav class="navbar-expand-lg navbar navbar-dark bg-dark navbar-toggleable-md">
    <div class="container">
        <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse">
            <span class="navbar-toggler-icon"></span>
        </button>
        <a class="navbar-brand" href="/" th:href="@{~/}">XHX Blog</a>
        <div class="collapse navbar-collapse" id="navbarsContainer">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item">
                    <a class="nav-link" th:href="@{~/users}">首页<span class="sr-only">(current)</span></a>
                </li>
            </ul>
            <!-- 登录判断 -->
            <div sec:authorize="isAuthenticated()" class="row">
                <!-- 已登录就用户名和退出按钮 -->
                <ul class="navbar-nav mr-auto">
                    <li class="nav-item">
                        <span class="nav-link" sec:authentication="name"></span>
                    </li>
                </ul>
                <form action="/logout" th:action="@{/logout}" method="post">
                    <input class="btn btn-outline-success" type="submit" value="退出"/>
                </form>
            </div>

            <div sec:authorize="isAnonymous()">
                <a href="/login" th:href="@{~/login}" class="btn btn-outline-success my-2 my-sm-0" type="submit">登录</a>
            </div>
        </div>
    </div>
</nav>
</body>
</html>